home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / raytrace / pov / gen / bstone / borlandc / bstone_m.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-16  |  7.4 KB  |  184 lines

  1. /***********************************************************************/
  2. /* Header for main bstone operations                                   */
  3. /***********************************************************************/
  4.  
  5. /* Command line                                                        */
  6. typedef struct cmd_line {
  7.              int n;
  8.              char *s;
  9.             } CMD_LINE;
  10.  
  11. typedef struct pov_obj  {
  12.              char *s;               /* name  */
  13.              char c;                /* code  */
  14.              /* 0 norm, 1 union, 2 intersect, 3 diff        */
  15.              short cnt;             /* number */
  16.              /* number of parents, -1 tmp (made w add_obj) */
  17.              double b[3];           /* basis */
  18.              double u[3];           /* x coord */
  19.              double v[3];           /* y_coord */
  20.              double w[3];           /* z_coord */
  21.              struct pov_obj *tex;   /* texture */
  22.              struct pov_obj *bound; /* bounded_by */
  23.             } POV_OBJ;
  24.  
  25. #define MAXDIM 10                               /* max num of dim      */
  26. typedef struct dim_h   {
  27.             int n;                  /* dimensions */
  28.             long l;                 /* length     */
  29.             long d[MAXDIM];
  30.             double *f;              /* pointer to field */
  31.                } DIM_H;
  32.  
  33. /*  FOR-TO-LOOP                                                     */
  34. typedef struct ft_loop {
  35.             int n;                  /* line number      */
  36.             double start;
  37.             double step;
  38.             double end;
  39.                } FT_LOOP;
  40.  
  41. #define MAX_LINES   1024                        /* max size of program */
  42.                         /* must be 2^n !!      */
  43. #define BSIZE       256                         /* buffer size         */
  44. #define LSIZE       512                         /* max size of line    */
  45. #define PSIZE       4096                        /* max size of obj str */
  46. #define SSIZE       24                          /* mod-len of string   */
  47. extern LEX *lex;                                /* lex structure       */
  48. extern CMD_LINE program[MAX_LINES];             /* the program         */
  49. extern int gosub_stack[MAX_LINES/10];           /* gosub stack         */
  50. extern int gosub_ptr;                           /* gosub stack ptr     */
  51. extern int program_ctr;            /* program counter, -1: no program  */
  52. extern int transl_flag;            /* Flag: exec 0                     */
  53.                    /*       translate 1                */
  54.                    /*       re-translate 2             */
  55. extern int load_flag;              /* Flag: Load new file              */
  56. extern int cont_line;              /* Line number to continue          */
  57. extern int cmdl,flev;              /* cmd-line counter, file level     */
  58. extern FILE *fp[10];               /* File stack                       */
  59. extern char cline[LSIZE];          /* translated cmd-line              */
  60. extern int clinep;                 /* translation pointer              */
  61. extern char *clines;               /* execution pointer                */
  62. extern char err_msg[BSIZE];        /* buffer for error strings         */
  63. extern char tmp_line[LSIZE];       /* temp. charbuf                    */
  64. extern FILE *errlog;               /* error logs                       */
  65. extern FILE *errlogz;
  66. extern int ybdebug;                /* parser debug flag                */
  67. extern int  break_en;              /* Break enabled                    */
  68. extern int  break_req;             /* Break requested                  */
  69. extern int  fkt_id;                /* Function index                   */
  70. extern POV_OBJ **obj_all;          /* List of temp.objects  [PSIZE]    */
  71.  
  72. #ifndef M_PI
  73. #define M_PI 3.14159265358979323846
  74. #endif
  75.  
  76.  
  77. /* Error messages etc.                                                 */
  78. /* err: Error number.                                                  */
  79. void basic_error(int err);
  80.  
  81. /* Makro: get lexical object                                           */
  82. #define GETLEX(p1) \
  83.  if(((p1)=t_lex(NULL,NO_FORCE))==(LEX *)NULL) basic_error(5);
  84. /* Makro: get value for token                                          */
  85. #define TOKENVAL(p1) (char)(t_tokenval(p1)+128)
  86. /* Makro: get token for value                                           */
  87. #define VALTOKEN(p1) t_valtoken((unsigned char)(p1)-128)
  88. /* Makro: read 4 byte Hex value                                         */
  89.  
  90. /* get hex values from string                                           */
  91. int get4hex(char *s);
  92. #define GET4HEX(s1) get4hex(s1)
  93.  
  94.  
  95. /* clear program pointer etc.                                          */
  96. void clear_program(void);
  97.  
  98. /* finds counter for line equal or greater n                           */
  99. int search_line(int n);
  100.  
  101. /* inserts line s at n, allocates memory for s                          */
  102. /* if s==NULL, delete line n                                            */
  103. int insert_line(int n, char *s);
  104.  
  105. /* translates cmd-line into internal representation                       */
  106. /* returns NULL, if error                                                 */
  107. char *translate_line(void);
  108.  
  109. /* re-translates cmd-line from internal representation                    */
  110. char *retransl_line(char *dline);
  111.  
  112. /* Parsing                                                                */
  113. int yyparse(void);
  114. int yylex(void);
  115. int yyerror(char *s);
  116.  
  117. /* executes command                                                       */
  118. void exec_line(char *dline);
  119.  
  120. /* debugging function                                                     */
  121. int symdebug(T_NODE * tnode);
  122.  
  123. /* delete vars                                                         */
  124. void del_vars(T_NODE * tnode);
  125.  
  126. /* delete program and variables                                        */
  127. void new(void);
  128.  
  129. /* Create a new POV-object                                             */
  130. int new_objz(void);
  131. POV_OBJ *new_obj(void);
  132.  
  133. /* Copy POV-object                                                     */
  134. POV_OBJ *obj_asn(POV_OBJ *pv1, POV_OBJ *pv2);
  135.  
  136. /* Copy string                                                         */
  137. char *cp_str(char *s);
  138.  
  139. /* Print Object                                                        */
  140. void print_obj( FILE *fep, POV_OBJ *pv );
  141.  
  142. /* save Program from line n1 to line n2                                */
  143. FILE *save_program( int n1, int n2, char *str );
  144.  
  145. /* makes object empty; free any pointer                                */
  146. void free_obj(POV_OBJ *pv);
  147. void del_obj(POV_OBJ *pv);
  148.  
  149. /* increases number of parents                                         */
  150. void add_objz(POV_OBJ *pv);
  151.  
  152. /* adds object to union etc.                                           */
  153. POV_OBJ *add_obj(POV_OBJ *pv1,POV_OBJ *pv2);
  154.  
  155. /* object debugging function                                           */
  156. void obj_deb(POV_OBJ *pv,int level,FILE *fep);
  157.  
  158. /* Makes a copy of texture and bound, if more than 1 parent */
  159. POV_OBJ *cp_tbx(POV_OBJ *p);
  160.  
  161. /* Translation, scaling, rotation                           */
  162. /* 1 standard space, 2 object space                         */
  163. POV_OBJ *yscale1(POV_OBJ *p,double v[]);
  164. POV_OBJ *yscale2(POV_OBJ *p,double v[]);
  165. POV_OBJ *yrot1(POV_OBJ *p,double v[]);
  166. POV_OBJ *yrot2(POV_OBJ *p,double v[]);
  167. POV_OBJ *ytransl1(POV_OBJ *p,double v[]);
  168. POV_OBJ *ytransl2(POV_OBJ *p,double v[]);
  169.  
  170. /* makes an object fitting into it's bounds                    */
  171. POV_OBJ *fit_obj(POV_OBJ *pv);
  172.  
  173. /* automatic bound                                              */
  174. POV_OBJ *bound_obj(POV_OBJ *pv);
  175.  
  176. /* Print Object                            */
  177. void print_obj( FILE *fep, POV_OBJ *pv );
  178.  
  179. /* Copies p to temporary object        */
  180. POV_OBJ *cp_tmp(POV_OBJ *p);
  181.  
  182.  
  183.  
  184.